<template>
	<view class="train-page">
		<view class="page-tab">
			<view @click="pageFla(0)" :class="fla ? 'isTab':''">培训课程</view>
			<view @click="pageFla(1)" :class="!fla ? 'isTab':''">学员风采</view>
		</view>
		<view>
			<view v-show="fla">
				<trainList ref="trainList"></trainList>
			</view>
			<view v-show="!fla">
				<studentList ref="studentList"></studentList>
			</view>
		</view>
	</view>
</template>

<script>
	import trainList from './trainList.vue';
	import studentList from './studentList.vue';
	const db = uniCloud.database();
	const dbCmd = db.command;
	export default {
		components: {
			trainList,
			studentList
		},
		data() {
			return {
				fla: false
			}
		},
		onLoad () {
			this.pageFla(0)
		},
		onShow() {
			const _this = this
			uni.getStorage({
				key: 'userInfo',
				success: function(res) {
					if (res.data) {
						const arr = []
						const file = res.data.portrait.split(',')
						_this.userInfo = res.data
					}
				},
				fail: function(res) {
					uni.navigateTo({
						url: '../login/login'
					});
				}
			})
		},
		created() {},
		mounted() {},
		methods: {
			pageFla (typ) {
				this.fla = typ == 0 ? true : false
				if (this.fla) {
					this.$refs.trainList.initData()
				} else {
					this.$refs.studentList.initData()
				}
			}
		}
	}
</script>

<style>
	.train-page {}

	.page-tab {
		display: flex;
	}

	.page-tab view {
		flex: 1;
		text-align: center;
		line-height: 50px;
		font-size: 36rpx;
		font-weight: 600;
	}
	.isTab {
		color: #fc993b;
	}
	.train-page .uni-date {
		width: 135px;
		display: inline-block;
	}
	
	.train-page .uni-select,
	.train-page .uni-date-x--border {
		border: none;
		border-bottom: none;
	}
	
	.train-page .uni-stat__select {
		width: 120px;
		display: inline-block;
	}
</style>
<style lang="scss">
</style>